<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>帖子详情</title>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body style="padding-top: 100px;">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div th:include="head :: head" th:remove="tag"></div>
            <h3 class="text-center" th:text="${post.topic}"></h3>
            <blockquote>
                <p th:text="${post.content }"></p>
                <p class="text-right"><small th:text="${username}"></small></p>
            </blockquote>
            <br/>
            <span th:each="reply:${replyList}">
                <p class="text-left lead">
                    <span th:text="${reply.replyContent}"></span>
                <p class="text-right"><small th:text="${reply.author}"></small></p>
                </p>
                <br/>
            </span>
            <br/>
            <p class="text-right">
                <small>浏览次数：<span th:text="${post.browseTimes}"></span></small>
            </p>
            <span th:if="${session.session_user == null}">
                <a th:href="@{/login}">登陆</a>后才可以回复
            </span>
            <span th:if="${session.session_user != null}">
                <span th:each="verificationError:${verificationErrors}">
                    <div class="alert alert-dismissable alert-danger">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <span th:text="${verificationError.defaultMessage}"></span>
                    </div>
                </span>
                <form role="form" th:action="@{/reply}" method="post">
                    <input type="hidden" id="postId" name="postId" th:value="${post.postId}">
                    <div class="form-group">
                        <textarea class="form-control" rows="4" name="replyContent" placeholder="回复" th:value="(${reply})?(${reply.replyContent})"></textarea>
                    </div>
                    <button type="submit" class="btn btn-default">回复</button>
                </form>
            </span>
        </div>
    </div>
</div>
</body>
</html>